#include <iostream>
#include <string>
using namespace std;
int hash1[130] = { 0 };
int main()
{
    string s1, s2, ret;
    getline(cin, s1);
    getline(cin, s2);
    for (auto& e : s2) hash1[e]++;
    for (auto& e : s1)
        if (hash1[e] == 0)
            ret += e;
    cout << ret << endl;
    return 0;
}

struct ListNode {
	int val;
	struct ListNode *next;
	ListNode(int x) :
			val(x), next(NULL) {
	}
};
// class Solution {
// public:
//     ListNode* FindFirstCommonNode( ListNode* pHead1, ListNode* pHead2) {
//         int len1 = 1, len2 = 1;
// 		ListNode* cur1 = pHead1, *cur2 = pHead2;
// 		ListNode* longhead = pHead1, *shorthead = pHead2;
// 		while(cur1->next)
// 		{
// 			len1++;
// 			cur1 = cur1->next;
// 		}
// 		while(cur2->next)
// 		{
// 			len2++;
// 			cur2 = cur2->next;
// 		}
// 		if(cur1 != cur2) return nullptr;
// 		int n = abs(len1 - len2);
// 		if(len1 < len2)
// 		{
// 			longhead = pHead2;
// 			shorthead = pHead1;
// 		}
// 		while(n--)
// 		{
// 			longhead = longhead->next;
// 		}
// 		while(longhead != shorthead)
// 		{
// 			longhead = longhead->next;
// 			shorthead = shorthead->next;
// 		}
// 		return longhead;
//     }
// };

class Solution {
public:
	ListNode* FindFirstCommonNode(ListNode* pHead1, ListNode* pHead2) {
		ListNode* cur1 = pHead1, * cur2 = pHead2;
		while (cur1 != cur2)
		{
			cur1 = cur1 != nullptr ? cur1->next : pHead2;
			cur2 = cur2 != nullptr ? cur2->next : pHead1;
		}
		return cur1;
	}
};
#include <iostream>
using namespace std;
long long n, s, h, y;

int main()
{
    string str;
    cin >> n >> str;
    for (int i = 0; i < n; i++)
    {
        if (str[i] == 's') s++;
        else if (str[i] == 'h') h += s;
        else if (str[i] == 'y') y += h;
    }
    cout << y << endl;
    return 0;
}